'use strict';(function(b){function E(c,a){var d;document.createEvent?(d=document.createEvent("HTMLEvents"),d.initEvent(a,!0,!0)):document.createEventObject&&(d=document.createEventObject(),d.eventType=a);d.eventName=a;c.dispatchEvent?c.dispatchEvent(d):c.fireEvent&&htmlEvents["on"+a]?c.fireEvent("on"+d.eventType,d):c[a]?c[a]():c["on"+a]&&c["on"+a]()}function z(c){var a=c.hasClass("wpf_form_scroll");c.removeClass("wpf_form_scroll");c.trigger("submit");a&&c.addClass("wpf_form_scroll")}var t=!1,A=300,
B=function(c,a,d){a&&!0===a()?d&&d():(a=document.createElement("script"),a.setAttribute("async","async"),a.onload=function(){d&&d();this.getAttribute("id")},document.head.appendChild(a),a.setAttribute("src",c))},x=function(c,a){0===c.length?a():B(c[0][0],c[0][1],function(){c.shift();x(c,a)})},F=function(c){var a=wpf.includes_url+"js/jquery/",d=[[a+"ui/core.min.js",function(){return"object"===typeof b.ui}],[a+"ui/mouse.min.js",function(){return"function"===typeof b.ui.mouse}],[a+"jquery.ui.touch-punch.js",
function(){return!("ontouchstart"in window)}],[a+"ui/slider.min.js",function(){return"function"===typeof b.ui.slider}]];wpf.load_jquery_ui_widget&&d.unshift([a+"ui/widget.min.js",function(){return"function"===typeof b.widget}]);x(d,function(){c()})},G=function(c){b.fn.slider&&b(".wpf_slider",c).each(function(){var a=b(this).closest(".wpf_item"),d=a.find(".wpf_price_from"),e=a.find(".wpf_price_to"),f=parseInt(b(this).data("min")),g=parseInt(b(this).data("max")),n=parseFloat(b(this).data("step")),h=
a.closest("form"),l=parseInt(d.val()),k=parseInt(e.val()),m=a.find(".wpf-price-min"),q=a.find(".wpf-price-max");f===parseInt(f,10)&&g===parseInt(g,10)&&(l=l?l:f,k=k?k:g,b(this).slider({range:!0,min:f,step:isNaN(n)||0>=n?1:n,max:g,values:[l,k],slide:function(r,p){m.text(p.values[0]);q.text(p.values[1])},stop:function(r,p){d.val(p.values[0]);e.val(p.values[1]);h.hasClass("wpf_submit_on_change")&&h.trigger("submit")}}),b(this).slider().on("slidechange",function(r,p){b(p.handle).find(".wpf_tooltip_amount").html(p.value)}))})},
H=function(c){b("body").off("click.wpfGroupToggle").on("click.wpfGroupToggle",".wpf_grouped_label",function(a){var d=b(this).next(".wpf_items_group"),e=b(this);a.preventDefault();d.is(":visible")?d.slideUp(function(){e.addClass("wpf_grouped_close")}):d.slideDown(function(){e.removeClass("wpf_grouped_close")})});b(".wpf_items_grouped:not(.wpf_layout_horizontal) .wpf_item_name",c).each(function(){b(this).closest(".wpf_item_onsale, .wpf_item_instock").length||b(this).addClass("wpf_grouped_label").trigger("click")})},
y=function(c=null){var a=b(".wpf-search-container",c).first();0===a.length&&(a=b(".wc-products.loops-wrapper",c).parent(),0===a.length&&(a=b(".woocommerce ul.products",c).parent(),0===a.length&&(a=b("ul.products",c).parent(),0===a.length&&(a=b(".post",c).first()))));return a.first().addClass("wpf-search-container")},J=function(){var c;b("body").off("submit.wpfForm").on("submit.wpfForm",".wpf_form",function(a){a.preventDefault();var d=b(this),e=y();a=d.serializeArray();var f={},g=d.hasClass("wpf_form_scroll");
for(h in a)if(a[h].value.trim()){var n=a[h].name.replace("[]","");f[n]=f[n]?f[n]+(","+a[h].value):a[h].value}t&&(f.append=1);d.find('input[name="wpf_page"]').val("");if(e.length&&"function"===typeof Isotope){var h=e[0].getElementsByClassName("products");c=c||0<h.length&&Isotope.data(h[0])}d.hasClass("wpf_form_ajax")&&!e.length&&d.removeClass("wpf_form_ajax").attr("action",d.attr("data-shop"));var l=new URL(d.prop("action"));for(const k in f)l.searchParams.set(k,f[k]);if(!d.hasClass("wpf_form_ajax"))return window.location=
l.toString(),!1;l.searchParams.set("wpf_ajax",1);b.ajax({url:l.toString(),type:"GET",beforeSend:function(){document.body.classList.add("wpf_loading");d.addClass("wpf-search-submit");e.addClass("wpf-container-wait")},complete:function(){document.body.classList.remove("wpf_loading");d.removeClass("wpf-search-submit");e.removeClass("wpf-container-wait")},success:function(k){if(k){l.searchParams.delete("wpf_ajax");history.replaceState({},null,l.toString());var m=e,q=null,r=b(".products",e).attr("class");
k=b(k);var p=y(k);e.data("slug",d.data("slug"));b.event.trigger("wpf_ajax_before_replace");t?(q=p.find(".product"),q.addClass("wpf_transient_product").removeClass("first last"),b(".products",e).first().append(q),m=r.match(/columns-(\d)/),null!==m&&(m=parseInt(m[1]),b(".products",e).first().find(".product:nth-child("+m+"n+1)").addClass("first").end().find(".product:nth-child("+m+"n)").addClass("last")),m=k.find(".wpf_infinity a"),0<m.length&&b(".wpf_infinity a",e).data({current:m.data("current"),max:m.data("max")}),
e.removeClass("wpf-infnitiy-scroll"),m=q.first(),delete f.append,setTimeout(function(){t=!1},200)):(b(".wpf-pagination").remove(),p.find(".product").length?(e.empty().append(p.removeAttr("class")),C(e)):e.empty().append(d.find(".wpf-no-products-found").clone().show()));let u;c&&"function"===typeof(null==(u=Themify)?void 0:u.isoTop)?Themify.isoTop(e.find(".products")):g&&I(m);null!==q&&q.addClass("wpf_transient_end_product");void 0!==window.wp&&void 0!==window.wp.mediaelement&&window.wp.mediaelement.initialize();
b.event.trigger("wpf_ajax_success");E(window,"resize")}}})})},I=function(c){0<c.length&&b("html,body").animate({scrollTop:c.offset().top-b("#wpadminbar").outerHeight(!0)-10},1E3)},v=b(),w=function(c,a){v.length||(v=y());if(!t&&(a||window.scrollY>v.offset().top+v.outerHeight()-A||window.innerHeight+window.pageYOffset>=document.body.offsetHeight)){c=b(".wpf-search-container");var d=b(".wpf_infinity a",c),e=b(".wpf_form_"+c.data("slug"));e.length||(e=b(".wpf_form:first"));if(e.length){var f=d.data("current");
f<=d.data("max")&&(e.find('input[name="wpf_page"]').val(f),t=!0,a||c.addClass("wpf-infnitiy-scroll"),z(e),f+1>d.data("max")&&(b(".wpf_infinity").remove(),a||b(this).off("scroll",w)))}}},K=function(){if(0<b(".wpf_infinity_auto").length)b("#load-more").remove(),b(window).off("scroll",w).on("scroll",w);else if(0<b(".wpf_infinity").length)b(".wpf_infinity").closest(".wpf-hide-pagination").removeClass("wpf-hide-pagination"),b("#load-more").remove(),b("body").off("click.wpfInfinity").on("click.wpfInfinity",
".wpf_infinity a",function(c){c.preventDefault();c.stopPropagation();w(c,1)});else b("body").off("click.wpfPagination").on("click.wpfPagination",".wpf-pagination a,.woocommerce-pagination a",function(c){if("1"==(new URL(window.location.href)).searchParams.get("wpf")){var a=b(this).closest(".wpf-search-container").data("slug");a=b(".wpf_form_"+a);if(0<a.length&&0<a.find('input[name="wpf_page"]').length){c.preventDefault();c=a.find('input[name="wpf_page"]');var d=c.val,e=b(this),f=parseInt(e.text());
if(!f){f=parseInt(e.closest(".woocommerce-pagination,.pagenav").find(".current").text());e.hasClass("next")?++f:--f;var g=RegExp("(?<=paged=)[^\bs=]+");!f&&g.test(e.attr("href"))&&(f=e.attr("href").match(g)[0])}d.call(c,f);z(a)}}})},L=function(c){var a=wpf.includes_url+"js/jquery/ui/",d=[[a+"core.min.js",function(){return"object"===typeof b.ui}],[a+"position.min.js",function(){return"object"===typeof b.ui.position}],[a+"menu.min.js",function(){return"function"===typeof b.ui.menu}],[a+"autocomplete.min.js",
function(){return"function"===typeof b.ui.autocomplete}]];wpf.load_jquery_ui_widget&&d.unshift([a+"widget.min.js",function(){return"function"===typeof b.widget}]);x(d,function(){c()})},M=function(c){if(b.fn.autocomplete){var a=[];b(".wpf_autocomplete input",c).each(function(){var d=b(this),e=0<d.closest(".wpf_item_sku").length?"sku":"title",f=d.next(".wpf-search-wait"),g=d.closest("form"),n=g.hasClass("wpf_submit_on_change");a[e]=[];b(this).autocomplete({minLength:0,classes:{"ui-autocomplete":"highlight"},
source:function(h,l){var k=b.trim(h.term);n&&0===k.length&&0===h.term.length&&g.trigger("submit");1>k.length||(h.term=k,k=k.toLowerCase(),k in a[e]?l(a[e][k]):(f.show(),h.key=e,h.action="wpf_autocomplete","no"===d.data("variation")&&(h.variation="no"),b.post(wpf.ajaxurl,h,function(m,q,r){f.hide();for(const u in m){q=m[u];r=m[u].label;var p=document.createElement("textarea");p.innerHTML=r;q.label=p.innerText}a[e][k]=m;l(m)},"json")))},select:function(h,l){a:{try{new URL(l.item.value)}catch(k){h=!1;
break a}h=!0}h?window.location=l.item.value:(d.val(l.item.value),n&&g.trigger("submit"));return!1}}).on("focus",function(){0<d.val().trim().length&&b(this).autocomplete("search")}).autocomplete("widget").addClass("wpf_ui_autocomplete")})}},N=function(){function c(d,e){e=e.closest(".wpf-search-container").data("slug");e=b(".wpf_form_"+e);0<e.length&&0<e.find('input[name="orderby"]').length&&(e.find('input[name="orderby"]').val(d),e.trigger("submit"))}const a=b(".wpf-search-container");a.on("form.woocommerce-ordering",
"submit",function(d){d.preventDefault();c(b(this).find("select").val(),b(this))});a.find("select.orderby").on("change",function(d){c(b(this).val(),b(this))});a.data("slug")||a.data("slug",b(".wpf_form").last().data("slug"))},O=function(c){0<b(".wpf_submit_on_change",c).length&&b(".wpf_submit_on_change",c).each(function(){var a=b(this);a.find('input[type!="text"],select').on("change",function(d){"price"==b(this).attr("name")&&b(this).is(":checked")&&(b(".wpf_price_range label").removeClass("active"),
b(this).next("label").addClass("active"));a.trigger("submit")});a.find(".wpf_pa_link").on("click",function(d){d.preventDefault();b(this).find("input").prop("checked",!0).trigger("change")})})},P=function(c){var a=b(".wpf_layout_horizontal",c);if(0<a.length){D(a);a.find(".wpf_item:not(.wpf_item_onsale):not(.wpf_item_instock)").hover(function(){b(this).children(".wpf_items_group").stop().fadeIn()},function(){var e=b(this);if(0===e.closest(".wpf-search-submit").length){var f=!0;b(".wpf_ui_autocomplete",
c).each(function(){if(b(this).is(":hover"))return f=!1});f&&e.children(".wpf_items_group").stop().fadeOut()}});navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/)&&a.find(".wpf_item:not(.wpf_item_onsale):not(.wpf_item_instock) .wpf_item_name").click(function(){var e=b(this).parent(),f=e.children(".wpf_items_group").is(":visible"),g=e.hasClass("wpf_touched");f&&!g?(e.addClass("wpf_touch_tap"),e.trigger("mouseleave")):
f||g?g&&e.removeClass("wpf_touched"):(e.removeClass("wpf_touch_tap"),e.trigger("mouseenter"),e.removeClass("wpf_touched"))});var d;b(window).resize(function(e){clearTimeout(d);d=setTimeout(function(){D(a)},500)})}},D=function(c){c.each(function(){var a=b(this),d=a.find(".wpf_items_group"),e=Math.ceil(d.length/2),f=d.last().closest(".wpf_item"),g=f.offset().left;d.each(function(){var l=b(this).closest(".wpf_item");g<l.offset().left&&(f=l,g=l.offset().left)});var n=d.first().closest(".wpf_item").offset().left-
2,h=g+f.outerWidth(!0);g=f=null;d.each(function(l){var k=b(this).closest(".wpf_item"),m=k.offset().left;1E3<screen.width?(b(this).css("left",""),l+1>=e?b(this).removeClass("wpf_left_tab").addClass("wpf_right_tab").outerWidth(Math.round(m+k.width()-n)):b(this).removeClass("wpf_right_tab").addClass("wpf_left_tab").outerWidth(Math.round(h-m))):b(this).removeClass("wpf_right_tab").addClass("wpf_left_tab").outerWidth(Math.round(a.width())).css("left",-1*(m-a.offset().left))})})},Q=function(c){B(wpf.url+
"js/select2.min.js",function(){return"function"===typeof b.fn.select2},function(){c()})},R=function(c){function a(d,e){e=d.find('[value="'+e+'"]').text();d.next(".select2").find('[title="'+e+'"]').addClass("wpf_disabled")}b.fn.select2&&b(".wpf_form",c).find("select").each(function(){var d=b(this),e=d.prop("multiple"),f=e?d.data("selected"):!1;d.select2({dir:wpf.rtl?"rtl":"ltr",minimumResultsForSearch:10,dropdownCssClass:"wpf_selectbox",allowClear:!f&&e,placeholder:e?"":!1});f&&e&&(a(d,f),d.on("change",
function(g){a(d,f)}))})},S=function(c){b(".wpf_reset_btn",c).each(function(){this.addEventListener("click",function(a){a.preventDefault();a=a.target;var d=a.closest(".wpf_item");d=null===d?a.closest(".wpf_form"):d;for(var e=d.querySelectorAll("input,select"),f=e.length-1;0<=f;f--)if(!e[f].hasAttribute("readonly"))if("INPUT"===e[f].tagName)switch(e[f].type){case "text":e[f].value="";break;case "radio":case "checkbox":e[f].checked=!1}else e[f].selectedIndex=0,b(e[f]).val(null).trigger("change");b(d).find(".wpf_slider").each(function(){var g=
b(this),n=g.data("min"),h=g.data("max");g.siblings(".wpf_price_from").val(n);g.siblings(".wpf_price_to").val(h);g.closest(".wpf_item").find(".wpf-price-min").text(n).end().find(".wpf-price-max").text(h);g.slider("values",0,n);g.slider("values",1,h)});b(a.closest(".wpf_form")).trigger("submit")})})},T=function(c){if(window.location.href.includes("wpf=")){const a=c.hasClass("wpf-search-container")?c:c.find(".wpf-search-container");b(".woocommerce-pagination",a).each(function(){b(this).closest(".wpf-pagination").length||
b(this).addClass("wpf-hide")})}b(".wpf-pagination",c).each(function(){b(this).insertAfter(b(this).parent())})},C=function(c){c=c||b("body");b(".wpf_form",c).css("visibility","visible");P(c);H(c);!b(".wpf_form",c).find("select").length||"ontouchstart"in window||0<navigator.msMaxTouchPoints||Q(function(){R(c)});b(".wpf_slider",c).length&&F(function(){G(c)});A=b(".wpf_form").data("infinitybuffer");K();N();O(c);b(".wpf_autocomplete input",c).length&&L(function(){M(c)});J();S(c);T(c)};window.addEventListener("load",
function(){if(0<b(".wpf_form").length){b("body").addClass("woocommerce");var c,a=document.querySelector(".et_pb_module.et_pb_shop .woocommerce"),d=document.querySelector(".elementor-element.elementor-wc-products");null!==a?(a.className+=" wpf-search-container",(a=a.querySelector("ul.products"))&&(c=a.className.match(/columns-(\d+)/))):null!==d?(d.className+=" wpf-search-container",c=d.querySelector("ul.products").className.match(/columns-(\d+)/)):(a=document.querySelector(".wc-products"),null!==a?
c=a.className.match(/grid(\d+)/):(a=document.querySelector(".woocommerce > .products"),null!==a&&(c=a.className.match(/columns-(\d+)/),c=null!==c?c:a.parentElement.className.match(/columns-(\d+)/))));null!==c&&void 0!=c&&(document.querySelector('[name="wpf_cols"]').value=c[1]);C()}},{once:!0,passive:!0})})(jQuery);
